{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}{{enumName}}Decoder : Json.Decode.Decoder {{classname}}{{nameInCamelCase}}
{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}{{enumName}}Decoder =
    Json.Decode.{{#isString}}string{{/isString}}{{^isString}}int{{/isString}}
        |> Json.Decode.andThen
            (\value ->
                case value of
{{#allowableValues}}
{{#enumVars}}
                    {{#isString}}{{{value}}}{{/isString}}{{^isString}}{{name}}{{/isString}} ->
                        Json.Decode.succeed {{classname}}{{enumName}}{{name}}

{{/enumVars}}
{{/allowableValues}}
                    other ->
                        Json.Decode.fail <| "Unknown type: " ++ {{^isString}}String.fromInt {{/isString}}other
            )